<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人中心 - AI故事生成器</title>
    <!-- Bootstrap CSS -->
{#    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">#}
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" href="/static/css/header.css">
    <link rel="stylesheet" href="/static/css/footer.css">
    <link rel="stylesheet" href='/static/css/index.css'>
    <link rel="stylesheet" href='/static/css/personal_center.css'>
    <script src="/static/js/header.js" defer></script>
    <script src="/static/js/index.js"></script>
</head>
<body>
{% include 'header.html' %}


    <div class="profile-container">
        <div class="profile-header">
            <!-- 头像区域 -->
            <div class="avatar-container">
                <img src="/static/img/default.jpg" alt="用户头像" class="user-avatar">
            </div>

            <!-- 用户信息区域 -->
            <div class="user-info">
                <h2>{{ user.username }}的个人中心</h2>
                <div class="info-item">
                    <strong>昵称：</strong>{{ user.nicheng }}
                </div>
                <div class="info-item">
                    <strong>用户状态：</strong>
                    {% if user.status == '启用' %}
                        <span class="status-badge status-approved">{{ user.status }}</span>
                    {% else %}
                        <span class="status-badge status-disabled">{{ user.status }}</span>
                    {% endif %}
                </div>
                <div class="info-item">
                    <strong>用户分类：</strong>{{ user.gategory }}
                </div>
                <div class="info-item">
                    <strong>简介：</strong>{{ user.jianjie }}
                </div>
                <div class="info-item">
                    <strong>违规记录：</strong>{{ user.rules.name }}
                </div>
            </div>
        </div>

        <!-- 数据统计 -->
        <div class="row">
            <div class="col-md-4">
                <div class="stats-card bg-light">
                    <div class="stats-number">{{ user_stories.count }}</div>
                    <div>发布的故事</div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="stats-card bg-light">
                    <div class="stats-number">{{ user_comments.count }}</div>
                    <div>发表的评论</div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="stats-card bg-light">
                    <div class="stats-number">{{ total_likes }}</div>
                    <div>总获赞数</div>
                </div>
            </div>
        </div>

        <!-- 我的故事 -->
        <div class="profile-section mt-5">
            <h3 class="section-title">我的故事</h3>
            {% if user_stories %}
                {% for story in user_stories %}
                <div class="story-item">
                    <h5 class="story-title">{{ story.title }}</h5>
                    <div class="info-item">
                        <strong>发布时间：</strong>{{ story.date|date:"Y-m-d" }}
                    </div>
                    <div class="info-item">
                        <strong>分类：</strong>
                        {% for category in story.gategory.all %}
                            <span class="badge bg-secondary">{{ category.name }}</span>
                        {% endfor %}
                    </div>
                    <div class="info-item">
                        <strong>状态：</strong>
                        {% if story.status == '已审核' %}
                            <span class="status-badge status-approved">{{ story.status }}</span>
                        {% else %}
                            <span class="status-badge status-pending">{{ story.status }}</span>
                        {% endif %}
                    </div>
                    <div class="info-item">
                        <strong>阅读量：</strong>{{ story.read }} | 
                        <strong>点赞数：</strong>{{ story.likes }}
                    </div>
                    <div class="info-item">
                        <strong>违规记录：</strong>{{ story.rules.name }}
                    </div>
                    <a href="#" class="btn btn-sm btn-outline-primary mt-2">查看详情</a>
                </div>
                {% endfor %}
            {% else %}
                <p class="text-muted">暂无发布的故事</p>
            {% endif %}
        </div>

        <!-- 我的评论 -->
        <div class="profile-section mt-5">
            <h3 class="section-title">我的评论</h3>
            {% if user_comments %}
                {% for comment in user_comments %}
                <div class="comment-item">
                    <div class="info-item">
                        <strong>故事：</strong>{{ comment.store.title }}
                    </div>
                    <div class="info-item">
                        <strong>评论时间：</strong>{{ comment.store.date|date:"Y-m-d" }}
                    </div>
                    <div class="info-item">
                        <strong>状态：</strong>
                        {% if comment.status == '已审核' %}
                            <span class="status-badge status-approved">{{ comment.status }}</span>
                        {% else %}
                            <span class="status-badge status-pending">{{ comment.status }}</span>
                        {% endif %}
                    </div>
                    <div class="comment-content">{{ comment.content }}</div>
                    <div class="info-item">
                        <strong>违规记录：</strong>{{ comment.rules.name }}
                    </div>
                </div>
                {% endfor %}
            {% else %}
                <p class="text-muted">暂无发表的评论</p>
            {% endif %}
        </div>

        <div class="profile-actions mt-4" style="margin-top: 20px">
            <a href="{% url 'store_system:index' %}" class="btn btn-primary">返回首页</a>
        </div>
    </div>

{% include 'footer.html' %}
</body>
</html>